package com.itheima.controller.backend.security.security;

import com.itheima.Service.OrderService;
import com.itheima.common.entity.PageResult;
import com.itheima.common.entity.QueryPageBean;
import com.itheima.common.entity.Result;
import com.itheima.pojo.Order;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @PostMapping("/findPage")
     public PageResult findPage(
             @RequestBody QueryPageBean page
     ){
        log.info("分页查询");
        PageResult pageResult = orderService.findPage(page);
        return pageResult;
    }

    //根据id跟新order
    @PostMapping("update")
    public Result update(@RequestBody Order order){
        log.info("更新order");
        orderService.update(order);
        return new Result(true, "修改预约状态成功",null);
    }


}
